import { Rate } from 'antd';
import React, { useState, useEffect } from 'react';

const Rater_c = (props) => {
  // console.log(props.C_content);
  // console.log(props.content.professionalDegree);
  // const desc =[props.c_content]
  const desc = ['极差', '差', '一般', '好', '极好'];

  useEffect(() => {
    // setvalue()
    setxing()
  }, [])
  const [value, setvalue] = useState(2)
  const setxing = () => {
    switch (props.C_content) {
      case "极差":
        // value = 1;
        setvalue(1)
        break;
      case "差":
        // value = 2;
        setvalue(2)
        break;
      case "一般":
        // value = 3;
        setvalue(3)
        break;
      case "好":
        // value = 4;
        setvalue(4)
        break;
      case "极好":
        // value = 5;
        setvalue(5)
        break;
      default:
        value = 0;
    }
  }

  return (
    <span>
      <Rate tooltips={desc} disabled value={value} />
      {value ? <span className="ant-rate-text">{desc[value - 1]}</span> : ''}
    </span>
  );
}

export default Rater_c